package com.feilo.biz.impl;

import java.util.List;

import com.feilo.biz.UserBiz;
import com.feilo.dao.UserDao;
import com.feilo.dao.impl.UserDaoImpl;
import com.feilo.entity.User;

public class UserBizImpl implements UserBiz {
	UserDao ud=new UserDaoImpl();
	public void delete(Integer id) {
		ud.delete(id);
	}

	public User getUser(Integer userid) {
		return ud.find(userid);
	}

	@SuppressWarnings("unchecked")
	public List<User> getUsers() {
		String hql="from User order by id desc";
		List<User> u= (List<User>) ud.findByHQL(hql);
		return  u;
	}

	public void save(User user) {
		ud.save(user);

	}

	public void update(User user) {
		ud.update(user);
	}

	@SuppressWarnings("unchecked")
	public List<User> getUsersBySerch(String parm) {
		String hql="from User where u_username like'"+"%"+parm+"%"+"'"+"order by id desc";
		List<User> u= (List<User>) ud.findByHQL(hql);
		return  u;
	}

}
